﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Kugar.Core.BaseStruct;
using Kugar.UI.Web.AdminLTE.Interfaces;
using Kugar.UI.Web.AdminLTE.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Kugar.AdminLte.Core.Test.Managers
{
    public class AdminManager:IAdminLoginManager,IAdminManager,ILoginPageManager
    {

        public ResultReturn<string> Login( string userName, string password)
        {
            //return new FailResultReturn<string>("sdfsfsf");
            return new SuccessResultReturn<string>("sdfsfsf");
        }              

        public VM_PagedList<Model_AdminInfo> GetAdminList(string keyword = "", int state = -1, int pageIndex = 1, int pageSize = 20)
        {
            return new VM_PagedList<Model_AdminInfo>(new []
                                                    {
                                                        new Model_AdminInfo()
                                                        {
                                                            UserID = "1",
                                                            UserName = "aaaaaaaaaaaaaa",
                                                            Password = "b"
                                                        },
                                                        new Model_AdminInfo()
                                                        {
                                                            UserID = "2",
                                                            UserName = "bbbbbbb",
                                                            Password = "b"
                                                        },
                                                        new Model_AdminInfo()
                                                        {
                                                            UserID = "3",
                                                            UserName = "ccccccccccc",
                                                            Password = "b"
                                                        },
                                                        new Model_AdminInfo()
                                                        {
                                                            UserID = "4",
                                                            UserName = "dddddddddddddd",
                                                            Password = "b"
                                                        },

                                                    },pageIndex,totalCount:100);
        }

        public Model_AdminInfo GetAdminByID(string userID)
        {
            return new Model_AdminInfo()
                   {
                       UserID = "3",
                       UserName = "ccccccccccc",
                       Password = "b"
                   };
        }

        public ResultReturn<string> AddAdmin(string userName, string password, int state)
        {
            return new SuccessResultReturn<string>("3");
        }

        public ResultReturn UpdateAdmin(string userID, int state)
        {
            return new SuccessResultReturn("3");
        }

        public ResultReturn DeleteAdminByID(string userID)
        {
            return new SuccessResultReturn("3");
        }

        public ResultReturn ChangePassword(string userID, string oldPassword, string newPassword)
        {
            return new SuccessResultReturn();
        }

        public ResultReturn ChangePassword(string userID)
        {
            return new SuccessResultReturn("3");
        }

        public ResultReturn ResetPassword(string userID)
        {
            return new SuccessResultReturn("3");
        }

        public (string imageUrl, string gotoUrl)[] SliderImages(Controller controller, string sechemeName)
        {

            return null;
            //return new[]
            //{
            //    ("https://raw.githubusercontent.com/AngleSharp/AngleSharp.Samples/master/images/sheets.png", ""),
            //    ("/adminltebase/Content/images/login_background.jpg", ""),
            //};
        }

        public async Task<ResultReturn<string>> Login(HttpContext request, string userName, string password)
        {
            return new SuccessResultReturn<string>("sdfsfsf");
        }
    }
}
